<template>
	<view class="rectificationContent">
		<view class="upper">
			<CommonNavBar title="统计查询" :showSearch="true" @search="open"></CommonNavBar>
		</view>
		<view class="centre">
			<view class="buttonList">
				<view @tap="buttonActive(1)">已认领({{ buttonList.coveredCount }})</view>
				<view @tap="buttonActive(2)">已覆盖({{ buttonList.claimCount }})</view>
				<view @tap="buttonActive(3)">未覆盖({{ buttonList.notCoveredCount }})</view>
			</view>
			<newlyAddedCommonSearchCompontVue  @seacharResult="seacharResult" 
			 :showSearchCompont="showSearchCompont"  ></newlyAddedCommonSearchCompontVue>
		</view>
	</view>
</template>

<script>
	import CommonNavBar from '@/components/CommonNavBar.vue'
	import newlyAddedCommonSearchCompontVue from '@/components/newlyAddedCommonSearchCompont.vue'
	export default {
		components: {
			CommonNavBar,
			newlyAddedCommonSearchCompontVue
		},
		data() {
			return {
				searchParams: {
					checkType: 1,
					pageNum: 1,
					pageSize: 10,
					year: null
				},
				showSearchCompont:false,
				buttonList: {}
			}
		},
		created() {
		    this.initialData();
		},
		methods: {
			// 认领
			open() {
				this.showSearchCompont = true
			},
			seacharResult(e){
				//检索条件点击确定或者删除的时候在执行
				console.log('e', e)
				this.showSearchCompont =  false;
				if(e.search){ 
					this.searchParams = e;
				}
			},
			async initialData() {
				try {
					let res = await uni.$api.querySamplingStatistics(this.searchParams);
					this.buttonList = res.data.data;
				} catch (error) {
					console.error(error)
				}
			},
			buttonActive(number) {
				uni.navigateTo({
					url: '/pages/sampling/samplingCompany'
				});
			}
		}
	}
</script>


<style lang="scss">
	.rectificationContent {
		background: #F9F9F9;
		height: calc(100vh - 195rpx);

		.upper {
			position: fixed;
			z-index: 1;
			top: 0;
			left: 0;
			width: 100%;

			.title {
				background: url('../../static/img/inspectBg.png');
				background-size: cover;
				width: 100%;
				height: 115rpx;
				line-height: 115rpx;
				position: relative;
				display: flex;
				justify-content: center;

				.arrow {
					position: absolute;
					left: 33rpx;
					top: 50%;
					transform: translate(0%, -50%);
					width: 100rpx;
					height: 100rpx;

					&::before {
						display: block;
						content: "";
						position: absolute;
						top: 50%;
						left: 0%;
						width: 20rpx;
						height: 20rpx;
						border-left: 1px solid #fff;
						border-top: 1px solid #fff;
						transform: translate(0%, -50%) rotate(-45deg);
					}
				}

				text {
					font-size: 30rpx;
					font-family: PingFangSC-Medium, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					letter-spacing: 1px;
				}

				.screen {
					position: absolute;
					right: 30rpx;
					top: 50%;
					transform: translate(0%, -50%);
					width: 35rpx;
					height: 33rpx;
				}
			}

			.step {
				display: flex;
				justify-content: space-evenly;
				height: 80rpx;
				line-height: 80rpx;
				background: #F9F9F9;

				view {
					position: relative;
					font-size: 25rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					color: #999999;
					width: 100%;
					text-align: center;

					&.active {
						color: #0552A9;

						&::before {
							display: block;
							content: "";
							position: absolute;
							left: 50%;
							bottom: 0%;
							transform: translate(-50%, 0%);
							width: 100rpx;
							height: 5rpx;
							background: #0552A9;
						}
					}
				}
			}
		}

		.centre {
			margin: 110rpx 0 0 0;
			padding: 0 17.5rpx;
			height: calc(100vh - 280rpx);
			overflow-x: hidden;

			.buttonList {
				display: flex;
				flex-direction: column;
				align-items: center;
				margin: 50rpx 0 0 0;
					
				view {
					margin: 30rpx 0;
					background: #0552A9;
					color: #fff;
					padding: 20rpx 60rpx;
					border-radius: 8rpx;
					cursor: pointer;
					font-size: 24rpx;
				}
			}
		}
	}
</style>